package testcase.setting;

import basic.BasicCase;
import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Created by 13714526025 on 2018/9/17.
 * 查看隐私政策详情
 */
public class PrivateCat extends BasicCase {
    @Test
    public void testName() throws InterruptedException {
        Thread.sleep(7000);
        finder.waitforWebElement("com.oppo.ohome:id/iv_setting");
        //主界面点击“设置”按钮
        driver.findElement(By.id("com.oppo.ohome:id/iv_setting")).click();
        driver.findElement(By.id("com.oppo.ohome:id/policy_item")).click();
        //获取屏幕的宽和高
        int x=driver.manage().window().getSize().width;
        int y=driver.manage().window().getSize().height;
        //进行循环滑动
       for(int count=1;count<=3;count++){
           driver.swipe(x/2,y*3/4,x/2,y*1/4,2000);
       }
       //点击“查看隐私政策详情”
        driver.findElement(By.id("com.oppo.ohome:id/tv_link")).click();
        int pvtx=driver.manage().window().getSize().width;
        int pvty=driver.manage().window().getSize().height;
       for(int count=1;count<=10;count++){
           driver.swipe(pvtx/2,pvty*3/4,pvtx/2,pvty*1/4,2000);
       }
       //断言标题是否正确
       String privateTitle="隐私政策";
        Assert.assertEquals(driver.findElement(By.id("android:id/action_bar_title")).getText(),privateTitle);
    }
}
